﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
namespace SQT.tracnghiem.Ajax.ASP.Events
{
    public partial class ring_tttn : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int event_id = int.Parse(Request.QueryString["event_id"]);
            int type = int.Parse(Request.QueryString["type"]);
            int question = int.Parse(Request.QueryString["question"]);
            int player = int.Parse(Request.QueryString["player"]);
            var get_event = new TblEventRoomController().FetchAll().Where(x => x.EventId == event_id && x.GameType == type && x.GameId == question);

            if (get_event.ToList().Count == 0)
            {
                new TblEventRoomController().Insert(event_id, type, question, player, "", DateTime.Now);
                var get_room = new TblEventDetailController().FetchAll().Last();
                new TblEventDetailController().Update(get_room.Id, null, null, null, null, 2);
            }
        }
    }
}